<?php
    include_once(DAO_PATH . "/ProductDAO.php");
    include_once(OBJECT_PATH . "/Product.php");
?>

<form id="deleteForm" name="deleteForm" method="post" action="products.php?action=delete">

    <div class="form-label">Select a product to delete:</div>
    <div class="form-component">
        <select name="productId">
            <option value="0">Select</option>
            <?php
            $dao = new ProductDAO();
            $list = $dao->getProductList();

            $iterator = $list->getIterator();
            while ($iterator->valid())
            {
                $product = $iterator->current();
                ?>
                <option value="<?php echo $product->getId(); ?>"><?php echo $product->getName(); ?></option>
                <?php
                $iterator->next();
            }
            ?>
        </select>
    </div>

    <div style="text-align: center;">
        <input type="submit" value="Delete" />
        <input type="reset" value="Reset" />
    </div>

</form>